fishbowl: Remove visibility handling
authorTimm Bäder <mail@baedert.org>
Sat, 6 Jun 2020 06:31:35 +0000 (08:31 +0200)
committerTimm Bäder <mail@baedert.org>
Fri, 19 Jun 2020 03:26:24 +0000 (05:26 +0200)
First, almost all widgets are either visible and mapped, or visible and
unmapped because they are !child_visible. In both cases, we do care
about the size. If they are indeed invisible, gtk_widget_measure() will
take care of that by returning all 0.

And gtk_widget_unparent() already queues a resize on the parent if
necessary, so that is unneeded as well.

demos/gtk-demo/gtkfishbowl.c

index 47356924b679488e03ac3ad0b3fa264a460e84d7..ff30f1d87392ec66e5ff4fd545f36e80a4272fc4 100644 (file)
@@ -108,10 +108,6 @@ gtk_fishbowl_measure (GtkWidget      *widget,
     {
       child = value;
 
-      if (!gtk_widget_get_visible (child->widget))
-        continue;
-
-
       if (orientation == GTK_ORIENTATION_HORIZONTAL)
         {
           gtk_widget_measure (child->widget, orientation, -1, &child_min, &child_nat, NULL, NULL);
@@ -148,9 +144,6 @@ gtk_fishbowl_size_allocate (GtkWidget *widget,
     {
       child = value;
 
-      if (!gtk_widget_get_visible (child->widget))
-        continue;
-
       gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
       child_allocation.x = round (child->x * (width - child_requisition.width));
       child_allocation.y = round (child->y * (height - child_requisition.height));
@@ -197,17 +190,11 @@ gtk_fishbowl_remove (GtkFishbowl *fishbowl,
                      GtkWidget   *widget)
 {
   GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
-  GtkWidget *widget_bowl = GTK_WIDGET (fishbowl);
 
   if (g_hash_table_remove (priv->children, widget))
     {
-      gboolean was_visible = gtk_widget_get_visible (widget);
-
       gtk_widget_unparent (widget);
 
-      if (was_visible && gtk_widget_get_visible (widget_bowl))
-        gtk_widget_queue_resize (widget_bowl);
-
       priv->count--;
       g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_COUNT]);
     }